package com.zq;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DemoC3p0 {
    public static void main(String[] args) throws SQLException {
        ComboPooledDataSource pooledDataSource = new ComboPooledDataSource();
        for (int i = 1; i <= 5; i++) {
            Connection conn = pooledDataSource.getConnection();
            System.out.println("第" + i + "个连接对象：" + conn);
            //释放其中一个
            if (i==3) {
                conn.close();  //放回到连接池中
            }
        }
    }
}
